package com.akiokevin.plantyourlife.schedule;

import android.R;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

public class ScheduleAdapter extends ArrayAdapter<ScheduleEntry>{
	private ScheduleEntryList mSchedules;
	
	public ScheduleAdapter(Context ctx, int viewResourceId, ScheduleEntryList schedules) {
		super(ctx, viewResourceId, schedules);
		mSchedules = schedules;
	}
	
	 @Override
     public View getView(int position, View convertView, ViewGroup parent) {
	     View v = convertView;
	     if (v == null) {
	         LayoutInflater vi = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
	         v = vi.inflate(R.layout.schedule_row, null);
	     }
	     ScheduleEntry schedule = mSchedules.get(position);
	     if (schedule != null) {
	             TextView result = (TextView) v.findViewById(R.id.cell_result);
	             TextView desc = (TextView) v.findViewById(R.id.cell_desc);
	             TextView time = (TextView) v.findViewById(R.id.cell_time);
	             if (tt != null) {
	                   tt.setText("Name: "+o.getOrderName());                            }
	             if(bt != null){
	                   bt.setText("Status: "+ o.getOrderStatus());
	             }
	     }
     return v;
     }
	
}
